#! -*- coding:utf-8 -*-
#wrk -t12 -c400 -d30s http://127.0.0.1:8080/halo   压力测试

import urllib
import json
import time

url = 'http://127.0.0.1:8080/halo'

while True:
    t1 = time.time()
    print(t1)

    # 并不能保证每一次请求都能返回结果。必需设置timeout
    res = json.loads(urllib.request.urlopen(url, timeout=10).read().decode('utf-8'))

    dt = time.time() - t1
    print("耗时" + "%.2f秒" % dt)
    print(res)
    time.sleep(0.01)